package com.edou.system.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.edou.base.page.PageResult;
import com.edou.system.dao.ISysUploadSetDao;
import com.edou.system.entity.SysUploadSet;
import com.edou.system.service.ISysUploadSetService;

import com.edou.system.dto.SysUploadSetCondition;

@Service("sysUploadSetServiceImpl")
@Transactional(value = "transactionManager")
public class SysUploadSetServiceImpl implements ISysUploadSetService{

	@Resource(name = "sysUploadSetDaoImpl")
	private ISysUploadSetDao sysUploadSetDao;

	/**
	 * 分页查询
	 * @param pageResult 分页对象
	 * @param condition 查询条件类
	 */
	public void listSysUploadSetByPage(PageResult<SysUploadSet> pageResult,SysUploadSetCondition condition){
		int rows = sysUploadSetDao.listSysUploadSetByPageCount(condition);
		pageResult.setRows(rows);

		RowBounds rowBounds = new RowBounds(pageResult.getCurrentPageIndex(),pageResult.getPageSize());
		List<SysUploadSet> list = sysUploadSetDao.listSysUploadSetByPage(rowBounds,condition);
		pageResult.setResult(list);
	}

	/**
	 * 根据ID查询
	 * @param id 主键
	 * @return 文件上传路径设置
	 */
	public SysUploadSet getSysUploadSetById(String id){
		return sysUploadSetDao.getSysUploadSetById(id);
	}
	
	/**
	 * 获取系统设置
	 * @return
	 */
	public SysUploadSet getSysUploadSet(){
		return sysUploadSetDao.getSysUploadSet();
	}

	/**
	 * 新增
	 * @param item 文件上传路径设置
	 */
	public void add(SysUploadSet item){
		sysUploadSetDao.add(item);
	}

	/**
	 * 修改
	 * @param item 文件上传路径设置
	 */
	public void update(SysUploadSet item){
		sysUploadSetDao.update(item);
	}

	/**
	 * 根据ID集合批量删除
	 * @param ids ID集合
	 */
	public void delByIds(String[] ids){
		sysUploadSetDao.delByIds(ids);
	}

}

